﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TravelLink.WebModel;

namespace TravelLink.WebApp.UserControl {
    public partial class UC_Common_Head : ControlBase, ISetNav {

        public bool IsLogin {
            get {
                if (this.Page is Pagebase) {

                    return (this.Page as Pagebase).CurrentUser != null;
                }
                return false;
            }
        }

        public bool IsActive {
            get {
                if (IsLogin) {

                    return (this.Page as Pagebase).CurrentUser.DBUser.Status > 0;
                }
                return false;
            }
        }


        public string UserMail {
            get {
                if (!IsLogin) {
                    return string.Empty;
                }
                else {
                    return (this.Page as Pagebase).CurrentUser.DBUser.Email;
                }

            }
        }


        public bool NavDisplay {
            get { return this.UC_Nav1.Visible; }
            set { this.UC_Nav1.Visible = value; }
        }


        protected void Page_Load(object sender, EventArgs e) {
            if (!NavDisplay) {

            }
        }

        public void SetNav(Queue<NavItem> navs) {
            this.UC_Nav1.SetNav(navs);
        }
    }
}